#pragma once
#include "feVector.h"
#include "feSmartPtr.h"
#include "feMesh.h"
#include "feSingleton.h"

#define MAX_ARRAY_SIZE 10000

class feMeshFunction;

class feMaterial
{
	double DivGradCoeff;
	double WeightCoeff;
	double DudtCoeff;

	feMeshFunction *RightFunc;

	double ScaleF;
	double ScaleP;
	double ScaleT;
	fePoint LastP;
	int LastT;
	double LastF;

private:
	void Copy(feMaterial *iMat);

public:
	feMaterial()  { DivGradCoeff = 0; WeightCoeff = 0; DudtCoeff = 0; RightFunc = NULL; ScaleF = 1; ScaleP = 1; ScaleT = 1; LastT = -1;}
	feMaterial::feMaterial(feMaterial *iMaterial)	{ Copy(iMaterial);	}
	feMaterial::feMaterial(feMaterial& iMaterial)	{ Copy(&iMaterial);	}
	feMaterial(double iDivGradCoeff, double iWeightCoeff, double iDudtCoeff, feMeshFunction *iRightFunc = NULL,
																double iScaleF = 1, double iScaleP = 1, double iScaleT = 1);
	double GetF(fePoint *iPoint, int iLayer, int *iIndex=0);

	void SetRight(feMeshFunction *iNewF, double iScaleF = 1, double iScaleP = 1, double iScaleT = 1);
	feMeshFunction * GetRightFunction()	{ return RightFunc; }
	void GetCoeffs(feVector *oCoeffs)	{ oCoeffs->Data[0] = DivGradCoeff; oCoeffs->Data[1] = WeightCoeff; oCoeffs->Data[2] = DudtCoeff; }	
};